﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;
using TeamTasker.Client.BusinessLogic.Controllers;

namespace TeamTasker.Client.BusinessLogic.Commands
{
    public class LoginCommand : ICommand
    {
        #region ICommand Members

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            var controller = SessionController.GetInstance();
            var loginFormViewModel = (LoginFormViewModel) parameter;
            controller.Login(loginFormViewModel.LoginId, loginFormViewModel.Password);
            //TODO: NG: Process AutoStart and AutoLogin CheckBoxes Values.
        }
        
        public bool CanExecute(object parameter)
        {
            //Todo: NG Perform CLient password validation here
            return true;
        }

        #endregion
    }
}
